<template>
	<div class="ipPatent">
		<!-- 知识产权-专利导航栏 -->
		<div class="ipPatent_nav">
			<div class="ipPatent_nav_item" :class="ipPatentNum==0 ? 'active':''" @click="toNum(0)">全部专利({{allPatent}})</div>	
			<div class="ipPatent_nav_item" :class="ipPatentNum==1 ? 'active':''" @click="toNum(1)">发明申请({{inventzl}})</div>
			<div class="ipPatent_nav_item" :class="ipPatentNum==2 ? 'active':''" @click="toNum(2)">实用新型({{inventsq}})</div>
			<div class="ipPatent_nav_item" :class="ipPatentNum==3 ? 'active':''" @click="toNum(3)">外观设计({{practical}})</div>
		</div>
		<div class="ipPatent_form">
			<!-- 表格对应的4个圆点 -->
			<div class="lineRadius l1"></div>
			<div class="lineRadius l2"></div>
			<div class="lineRadius r1"></div>
			<div class="lineRadius r2"></div>
			<!-- 表格 -->
			<table class="ntable">
			    	<tr>
			    		<th width="45%" class="tx">专利名称</th> 
			    		<th  colspan="2">专利类型</th>
			     		<th colspan="">申请日 </th>
			     		<th colspan="" width="20%">公开号</th>
			     		<th colspan="">公开日 </th>
			     	</tr> 
			     	<tr v-for="(item,index) in baseData" :key="index">
			     		<td rowspan="1" v-html="item.name"></td> 
			     		<td colspan="2" class="left">{{item.type}}</td>
			     		<td colspan="" class="">{{item.startTime}}</td>
			     		<td colspan="" class="">{{item.num}}</td>
			     		<td colspan="" class="">{{item.endTime}}</td>
			     	</tr>
			     </table>
		</div>
	</div>
</template>

<script>
import  {SM4}  from 'gm-crypto'
	export default{
		props:{
			propTite:{
				type:String,
			}
		},
		name:'ipPatent',
		data() {
			return{
				ipPatentNum:0, //导航栏当前数
				sbcompany:'',  //当前公司名
				baseData:[], //基本信息
				allPatent:0,//全部专利数
				inventzl:0,//发明专利数
				inventsq:0,//发明专授权数
				practical:0,//实用新型数
				fieldList:[{
								"key":"company_name",
								"value":''
							}] //请求参数变量
			}
		},
		mounted() {
			this.getBasedata(0)
			this.getZhuanlidata()
		},
		methods:{
			// 获取对应的专利数
			async getZhuanlidata(){
				this.sbcompany=this.propTite
				var dt = {
					"randomNum": '0123456789abcdeffedcba9876543210',
    			"companyName": this.sbcompany,
    			"zlType": 0,
				};
				const aaa = await this.$api.post('/api/v1/cockpit/cockpitInterface?methodname=getCompanyEquityById', dt)
				const bbb = SM4.decrypt(aaa.data, '0123456789abcdeffedcba9876543210', {
					inputEncoding: 'base64',
					outputEncoding: 'utf8'
				})
				let result = JSON.parse(bbb)
				this.allPatent=result.allCount
				this.inventzl=result.fmsqCount
				this.inventsq=result.syxxCount
				this.practical=result.wgsjCount
			},
			// 获取全部专利数据
			async getBasedata(){
				this.sbcompany=this.propTite
				var dt = {
					"randomNum": '0123456789abcdeffedcba9876543210',
    			"companyName": this.sbcompany,
    			"zlType": this.ipPatentNum,
				};
				const aaa = await this.$api.post('/api/v1/cockpit/cockpitInterface?methodname=getCompanyEquityById', dt)
				const bbb = SM4.decrypt(aaa.data, '0123456789abcdeffedcba9876543210', {
					inputEncoding: 'base64',
					outputEncoding: 'utf8'
				})
				let result = JSON.parse(bbb)
				this.baseData=result.patentList

			},
			// 切换导航栏,获取对应的专利数据
			toNum(e){
				this.ipPatentNum=e
				this.getBasedata()
			}
		},
	}
</script>

<style lang="stylus" rel='stylesheet/stylus' scoped>
	@import "~@/assets/ipPatent1.styl"
</style>
